package com.e0box.game.event
{
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.events.TouchEvent;
	import flash.geom.Point;
	
	public class InputEvent extends Event
	{
		public static const ON_CLICK:String = "onClick";
		public static const ON_PRESS:String = "onPress";
		public static const ON_MOVE:String = "onMove";
		public static const ON_RELEASE:String = "onRelease";
		public static const ON_RESIZE:String = "onResize";
		public static const ON_ENTER_FRAME:String = "onEnterFrame";
		
		private var _position:Point;
		private var _isTouchEvent:Boolean;
		private var _touchSize:Point;
		
		private var _sourceEvent:Event
		public function InputEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(type, bubbles, cancelable);
		}
		
		public function get position():Point
		{
			return _position;
		}

		public function set position(value:Point):void
		{
			_position = value;
		}
		
		public function get isTouchEvent():Boolean
		{
			return _isTouchEvent;
		}
		
		public function set isTouchEvent(value:Boolean):void
		{
			_isTouchEvent = value;
		}
		
		public function get touchSize():Point
		{
			return _touchSize;
		}
		
		public function set touchSize(value:Point):void
		{
			_touchSize = value;
		}
		
		public function get sourceEvent():Event
		{
			return _sourceEvent;
		}
		
		public function set sourceEvent(value:Event):void
		{
			_sourceEvent = value;
		}
		
		public function updateAfterEvent():void{
			if(_sourceEvent){
				if(_sourceEvent is MouseEvent) (_sourceEvent as MouseEvent).updateAfterEvent();
				else if(_sourceEvent is TouchEvent) (_sourceEvent as TouchEvent).updateAfterEvent();
			}
		}
		
		override public function clone():Event{
			var tmp:InputEvent = new InputEvent(this.type, this.bubbles, this.cancelable);
			tmp.position = this.position;
			tmp.isTouchEvent = this.isTouchEvent;
			tmp.touchSize = this.touchSize;
			return tmp;
		}



	}
}